@extends('layouts.admin')
@section('css')
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-datepicker/css/datepicker.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet">
@endsection
@section('content')
<section id="main-content">
    <section class="wrapper">
        <!-- page start-->
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                  
                    
                    <header class="panel-heading">
                        <a href="{{ route('admin.statistics.groups.agents',['id'=>$r->group->id]) }}">【{{ $r->group->name }}】</a>->【<font color=red>{{ $r->user->name }}</font>】客户列表
                    </header>
                    <div class="panel-body">
                                <div class="adv-table">
                    <!-- <table class="table table-striped table-advance table-hover"> -->
                    <table  class="display table table-bordered table-striped" id="reply">
                        <thead>
                        <tr>
                             
                              <th>用户名</th>
                              <th>手机</th>                            
                              <th>余额</th>
                              <th>订单数</th>
                              <th>手续费总额</th>
                              <th>充值</th>
                              <th>提现</th>
                              <!-- <th>所属角色</th> -->
                              <th>创建时间</th>
                              
                            
                        </tr>
                        </thead>
                        <tbody>
                        @if($users)
                        @foreach($users as $user)
                             <tr class="gradeX">
                                  
                                  <td>{{ $user->name }}</td>
                                  <td>{{ $user->mobile }}</td>
                                  
                                  <td>{{ $user->balance }}</td>
                                  <td>{{ $user->order->count() }}</td>
                                  <td>{{ $user->order->sum('transaction_cost_rmb') }}</td>
                                  <td>{{ $user->recharge->where('status','=',1)->sum('money') }}</td>
                                  <td>{{ $user->withdrawals->sum('money') }}</td>
                                  <td>{{ $user->created_at }}</td>
                                  
                              </tr>
                          @endforeach
                          @endif
                        <tfoot>
                                      
                                      </tfoot>
                      
                        </tbody>
                    </table>
                    
                     </div>
                    </div>
                </section>
            </div>
        </div>
        <!-- page end-->
    </section>
</section>
@endsection
@section('javascript')
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
<!-- <script src="{{ asset('admin/js/advanced-form-components.js') }}"></script> -->
 <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
          $('#reply').dataTable( {
              "aaSorting": [[7, "desc" ]],
              "oLanguage": {
                   "oPaginate": {
                     "sLast": "最后一页",
                     "sNext":"下页",
                     "sPrevious":"上页",
                     "sEmptyTable":"表里没有数据",
                   },
                   "sInfo": " _START_ - _END_ / _TOTAL_ 条记录",
                   "sLengthMenu": "显示 _MENU_ 条记录",
                   "sSearch": "搜索:",
                 }
          } );
      } );

  </script>  
@endsection

